package top.guxx.mall.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;
import top.guxx.mall.service.IWeChatApiService;


/**
 * @Author：Guxx
 * @Description：
 * @Date：2024/11/2 20:24
 * @Filename：Retrofit2Config
 */
@Slf4j
@Configuration
public class Retrofit2Config {
    private static final String BASE_URL = "https://api.weixin.qq.com/";

    @Bean
    public Retrofit retrofit(){
        return  new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(JacksonConverterFactory.create()).build();
    }

    @Bean
    public IWeChatApiService weChatApiService(Retrofit retrofit){
        return retrofit.create(IWeChatApiService.class);
    }
}
